﻿<local:DocumentBase x:Class="WPFExcelReport.YAB50AV95"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:ReflectionStudio.Components.UserControls;assembly=ReflectionStudio.Core"
                    xmlns:db="clr-namespace:ReflectionStudio.Core.Database;assembly=ReflectionStudio.Core"
                    xmlns:fd="clr-namespace:Labs.Filtering;assembly=ReflectionStudio.Core"
                    xmlns:wep="clr-namespace:WPFExcelReport"                      
                    Loaded="Window_Loaded"
                    Title="Planning"  
                    HorizontalAlignment="Stretch"  Margin="0,0,0,0"  VerticalAlignment="Stretch"
     >
    <local:DocumentBase.Resources>
        <db:INTEXDataSet x:Key="iNTEXDataSet" />
        <CollectionViewSource x:Key="aBPOSViewSource" Source="{Binding Path=ABPOS, Source={StaticResource iNTEXDataSet}}" />
    </local:DocumentBase.Resources>
    <Grid DataContext=""  HorizontalAlignment="Stretch"  Margin="10,10,0,0"  VerticalAlignment="Stretch">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <WrapPanel Grid.Row="0" Name="zoneCommand" Height="34" Margin="0,0,0,6">
            <Button  Content="查询"  Height="23" HorizontalAlignment="Left" Margin="10,5,0,0" Name="btnQuery"
                            VerticalAlignment="Center" Width="75" Click="btnQuery_Click" />
            <Button Content="生成报表"  Height="23" HorizontalAlignment="Left" Margin="10,5,0,0" Name="btnReport"
                            VerticalAlignment="Top" Width="75"
                                Click="btnReport_Click"
                                />
        </WrapPanel>
        <StackPanel Grid.Row="1" >
            <Expander Header="查询条件" Name="zoneQueryCond"  IsExpanded="True" ExpandDirection="Up"
                      HorizontalAlignment="Stretch"  Margin="10,10,0,0"  VerticalAlignment="Stretch">
                <Grid >
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <StackPanel Grid.Row="0" >
                        <WrapPanel>
                            <Label Content="生产单号码:"    Width="120" HorizontalAlignment="Left" Margin="3"  FontSize="18" VerticalAlignment="Center" />
                            <TextBox Name="txtKRS" Width="30" HorizontalAlignment="Left" Background="Pink" FontSize="18" Text=""  CharacterCasing="Upper" AcceptsTab="False" MaxLength="2" />
                            <TextBox Name="txtLFD" Width="90" HorizontalAlignment="Left" Background="Beige" Text="" FontSize="18" Height="30" AcceptsTab="False" CharacterCasing="Upper" MaxLength="6" Panel.ZIndex="1" />
                            <TextBox Name="txtPOS" Width="60" HorizontalAlignment="Left" Background="YellowGreen" FontSize="18" Text="" Height="30"  AcceptsTab="False" MaxLength="3" Panel.ZIndex="2" />
                            <Label Content="品种:"  Width="55"  HorizontalAlignment="Left" Margin="3"  FontSize="18" VerticalAlignment="Center" />
                            <TextBox Name="txtArticle" Text="" Width="113"  HorizontalAlignment="Left" Background="Azure" FontSize="18" CharacterCasing="Upper" AcceptsTab="False" MaxLength="20" Panel.ZIndex="3" />
                            <CheckBox Content="未完成订单" Height="15" Name="txtERLKZ" Margin="20,10,0,0" Background="WhiteSmoke" />
                        </WrapPanel>
                        <WrapPanel>
                            <Label Content="日期从"  FontSize="18" Height="30" HorizontalAlignment="Left" Margin="0,10,0,0" Name="label1" 
                       VerticalAlignment="Top" Width="66"  />
                            <TextBox Name="gsendstartdate"  Height="30"  Width="90" HorizontalAlignment="Left" Background="Azure" FontSize="16" MaxLength="8" Panel.ZIndex="4" />
                            <DatePicker Grid.Column="1" HorizontalAlignment="Left" Margin="5,10,0,0" Name="gsendstartDateChooser" VerticalAlignment="Top" Width="130" 
                                SelectedDateChanged="gsendstartDateChooser_SelectedDateChanged"/>
                            <Label  Content="至"  FontSize="18" Height="30" HorizontalAlignment="Left" Margin="10,10,0,0" Name="label2" VerticalAlignment="Top" Width="29" />
                            <TextBlock Name="gsendenddate" Height="30"  Width="100" Background="Azure" FontSize="16" Text="" />
                            <DatePicker Grid.Column="1" HorizontalAlignment="Left" Margin="10,10,0,0" Name="gsendendDateChooser" VerticalAlignment="Top" Width="130" 
                                SelectedDateChanged="gsendendDateChooser_SelectedDateChanged"/>
                        </WrapPanel>
                    </StackPanel>
                </Grid>
            </Expander>
            <Expander Header="数据" Name="zoneDataList"  IsExpanded="True"
                      HorizontalAlignment="Stretch"  Margin="10,10,0,0"  VerticalAlignment="Stretch">
                
                    <fd:FilteringDataGrid AutoGenerateColumns="False" EnableRowVirtualization="True"  
                                              ItemsSource="{Binding Path=YABPOS}" 
                                              x:Name="ABPOSDataGrid" 
                                              CanUserReorderColumns="True"  
                                              CanUserResizeRows="True"
                                              CanUserSortColumns="True"
                                              IsFilteringCaseSensitive="False" 
                                              RowDetailsVisibilityMode="VisibleWhenSelected"   
                                              Width="1000"
                                              Height="500"
                                              EnableColumnVirtualization="True"  
                                              ScrollViewer.HorizontalScrollBarVisibility="Auto"
                                              ScrollViewer.VerticalScrollBarVisibility="Auto"
                                              SelectionChanged="ItemsControls_SelectionChanged"
                                              >
                    <DataGrid.Columns>
                        <!--P.ABPSTARTDAT , DFACTORY,  WEI, DORDERNO,YARN, YARNDES, COLOR, COLORDES, USAGE,
                            ARTICLE,  LASTDAT,ISSWEI,RECDAT,RECWEI , ENDDAT-->

                        <DataGridTextColumn  Binding="{Binding Path=STATUS}" Header="订单状态" Width="SizeToCells" MinWidth="40"/>
                        <DataGridTextColumn  Binding="{Binding Path=ABPSTARTDAT}" Header="计划开始" Width="SizeToCells" MinWidth="60"/>
                        <DataGridTextColumn  Binding="{Binding Path=DFACTORY}" Header="染厂" Width="SizeToHeader" MinWidth="80"/>
                        <DataGridTextColumn  Binding="{Binding Path=WEI}" Header="下单数量" Width="SizeToCells" MinWidth="40"/>
                        <DataGridTextColumn  Binding="{Binding Path=DORDERNO}" Header="订单号" Width="SizeToCells" MinWidth="60"/>
                        <DataGridTextColumn  Binding="{Binding Path=YARN}" Header="纱线编号" Width="SizeToCells" MinWidth="60"/>
                        <DataGridTextColumn  Binding="{Binding Path=YARNDES}" Header="纱线描述" Width="SizeToHeader" MinWidth="100"/>
                        <DataGridTextColumn  Binding="{Binding Path=COLOR}" Header="色号" Width="SizeToCells" MinWidth="30"/>
                        <DataGridTextColumn  Binding="{Binding Path=COLORDES}" Header="颜色" Width="SizeToCells" MinWidth="40"/>
                        <DataGridTextColumn  Binding="{Binding Path=USAGE}" Header="用途" Width="SizeToHeader" MinWidth="60"/>
                        <DataGridTextColumn  Binding="{Binding Path=ARTICLE}" Header="织造品种" Width="SizeToHeader" MinWidth="80"/>
                        <DataGridTextColumn  Binding="{Binding Path=LASTDAT}" Header="最后发纱日期" Width="SizeToCells" MinWidth="60"/>
                        <DataGridTextColumn  Binding="{Binding Path=ISSWEI}" Header="发纱总量" Width="SizeToCells" MinWidth="40"/>
                        <DataGridTextColumn  Binding="{Binding Path=RECDAT}" Header="最后收货日期" Width="SizeToCells" MinWidth="60"/>
                        <DataGridTextColumn  Binding="{Binding Path=RECWEI}" Header="收货总量" Width="SizeToCells" MinWidth="40"/>
                        <DataGridTextColumn  Binding="{Binding Path=ENDDAT}" Header="染纱交期" Width="SizeToCells" MinWidth="60"/>
                        <DataGridTextColumn  Binding="{Binding Path=REMARK}" Header="批色情况" Width="SizeToHeader" MinWidth="100"/>
                    </DataGrid.Columns>
                </fd:FilteringDataGrid>
            </Expander>
        </StackPanel>
    </Grid>
</local:DocumentBase>
